package com.example.mall.client;

import com.example.mall.client.fallback.OrderFeignClientFactory;
import com.example.mall.result.JSONResult;
import feign.Request;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @Author: xxxliu
 * @CreateTime: 2025-06-03
 * @Version: 1.0
 */
@FeignClient(value = "mall-service-order",fallbackFactory = OrderFeignClientFactory.class,configuration = OrderFeignClient.FeignConfig.class)
@RequestMapping("/order")
public interface OrderFeignClient {

    @RequestMapping(value="/one/{orderNo}",method= RequestMethod.GET)
    JSONResult selectByOrderNo(@PathVariable("orderNo")String orderNo);

    @Configuration
    public class FeignConfig {
        @Bean
        public Request.Options options() {
            return new Request.Options(10000, 60000); // 设置连接和读取超时时间
        }
    }
}
